<template >
    <div class="flowDialog">
        <el-dialog
            title=""
            fullscreen
            :visible.sync="searchPurchaseDialogShow"
            width="60%"
            :before-close="handleClose"
        >
          <tableList
              :showIndex="true"
              :radioSelect="true"
              border
              highlight-current-row
              :heightMin="130"
              :pageNumber="pages.current"
              :pageSize="pages.size"
              :total="pages.total"
              :keySet="keySet"
              :autoHeight="true"
              :tableData="listDetails"
              :paginationShow="true"

              @handleSizeChange="handleSizeChange"
              @handleCurrentChange="handleCurrentChange"
              @rowDblclick="rowDblclick"
          >
          </tableList>
        <!-- <template #yslbz="{row}">
            <div>
                {{ row.yslbz === 'Y' ? '有原税率':'无原税率' }}
            </div>
        </template>
        <template #slzsl="{row}">
            <div>
                {{ row.slzsl || 0 }}%
            </div>
        </template> -->
        </el-dialog>
    </div>
</template>
<script>
import tableList from '@/components/tableList/index.vue'
import {getPage} from "@/api/custom";
import mixinTable from "@/mixin/mtable";

export default {
    model: {
        prop:'searchPurchaseDialogShow',
        event: 'change'
    },
    props: {
        searchPurchaseDialogShow: {
            type: Boolean,
            default: false,
        },
    },
  mixins: [mixinTable],
  data() {
        return {
            keySet: [
              {
                  label: '获票人名称',
                  englishName: 'hprmc',
              },
              {
                  label: '开票名称',
                  englishName: 'kpmc',
              },
              {
                  label: '开票人纳税人识别号',
                  englishName: 'kprnsrsbh',
              },
              {
                  label: '购买方地址',
                  englishName: 'gmfdz',
              },
              {
                  label: '购买方电话',
                  englishName: 'gmfdh',
              },
              {
                  label: '购买方开户行',
                  englishName: 'gmfkhh',
              },
              {
                label: '购买方银行账号',
                englishName: 'gmfyhzh',
              }
          ],
          list:[],
          total:0,
          size: 10,
          current: 1,
          listDetails:[]
        }
    },
    created(){
        this.getList()
    },
    methods: {
      async getList(){
        this.loading = true
        let {data, code, message} = await getPage(
            {
              hprmc: this.searchParams.input1,
              kpmc: this.searchParams.input2,
              infoStatus: this.searchParams.select1,
              pageNo: this.pages.current,
              pageSize: this.pages.size,
            }
        )
        if (code == 200) {
          this.loading = false
          this.listDetails = data.records
          this.time = data.records[0]?.createTime

          this.pages.total = data.total
          this.pages.current = data.current
          this.pages.size = data.size

        } else {
          this.$message({
            type: 'error',
            message: message,
          })
        }
        this.loading = false
      },
        rowDblclick(row){
            this.$emit('change',false,row)
        },
        handleClose(){
            this.$emit('change',false)
        },
        handleSizeChange(val){
            this.$store.commit('flowInvoice/handlerPages',{size:val})
            this.$store.dispatch('flowInvoice/getList')
        },
        handleCurrentChange(val){
            this.$store.commit('flowInvoice/handlerPages',{current:val})
            this.$store.dispatch('flowInvoice/getList')
        },

    },
    components:{
        tableList
    }
}
</script>

<style lang="scss" scoped>
.flowDialog {

    input::-ms-clear {
        width: 0;
        height: 0;
    }

}
</style>